home *** CD-ROM | disk | FTP | other *** search
Wrap
global gOBJECTS, sCURSORSPRITE, gTimerList, theButtonClasses on ShowButtonClasses set theButtonClasses to [#ButtonDN: [], #ButtonAnimDN: [], #ButtonDNCOND: [], #DragDN: [], #OpenClose: [], #OpenCloseADDobj: [], #GrabDrag: [], #MultiStateCOND: [], #MultiState: []] end on cursorandupdate CallAnimEngine() CheckMIDI() updateStage() end on ButtonDNAction ObjRef set obj to getaProp(gOBJECTS, ObjRef) if not voidp(getaProp(getaProp(obj, #sound), #down)) then stopSound(getaProp(getaProp(obj, #sound), #down)) playSound(getaProp(getaProp(obj, #sound), #down), #keyframeCast) end if set the castNum of sprite getaProp(obj, #spriteNum) to getaProp(getaProp(obj, #cast), #down) updateStage() repeat while the stillDown if inside(point(the mouseH, the mouseV), getAt(getaProp(obj, #HotRect), 1)) then set the castNum of sprite getaProp(obj, #spriteNum) to getaProp(getaProp(obj, #cast), #down) else set the castNum of sprite getaProp(obj, #spriteNum) to getaProp(getaProp(obj, #cast), #UP) end if cursorandupdate() end repeat set myPoint to point(the mouseH, the mouseV) if not voidp(getaProp(getaProp(obj, #sound), #UP)) then stopSound(getaProp(getaProp(obj, #sound), #UP)) playSound(getaProp(getaProp(obj, #sound), #UP), #keyframeCast) end if set the castNum of sprite getaProp(obj, #spriteNum) to getaProp(getaProp(obj, #cast), #UP) updateStage() if inside(myPoint, getAt(getaProp(obj, #HotRect), 1)) then do(getaProp(getaProp(obj, #action), #UP)) end if end on ButtonDN ObjRef set obj to getaProp(gOBJECTS, ObjRef) if not voidp(getaProp(getaProp(obj, #sound), #down)) then stopSound(getaProp(getaProp(obj, #sound), #down)) playSound(getaProp(getaProp(obj, #sound), #down), #keyframeCast) end if set the castNum of sprite getaProp(obj, #spriteNum) to getaProp(getaProp(obj, #cast), #down) updateStage() repeat while the stillDown if inside(point(the mouseH, the mouseV), getAt(getaProp(obj, #HotRect), 1)) then set the castNum of sprite getaProp(obj, #spriteNum) to getaProp(getaProp(obj, #cast), #down) else set the castNum of sprite getaProp(obj, #spriteNum) to getaProp(getaProp(obj, #cast), #UP) end if cursorandupdate() end repeat set myPoint to point(the mouseH, the mouseV) if not voidp(getaProp(getaProp(obj, #sound), #UP)) then stopSound(getaProp(getaProp(obj, #sound), #UP)) playSound(getaProp(getaProp(obj, #sound), #UP), #keyframeCast) end if set the castNum of sprite getaProp(obj, #spriteNum) to getaProp(getaProp(obj, #cast), #UP) updateStage() if inside(myPoint, getAt(getaProp(obj, #HotRect), 1)) then do(getaProp(getaProp(obj, #action), #UP)) end if end on ButtonAnimDN ObjRef set obj to getaProp(gOBJECTS, ObjRef) set dncount to count(getaProp(getaProp(obj, #cast), #down)) set upcount to count(getaProp(getaProp(obj, #cast), #UP)) set theUP to getAt(getaProp(getaProp(obj, #cast), #UP), 1) set theDown to getAt(getaProp(getaProp(obj, #cast), #down), 1) if not voidp(getaProp(getaProp(obj, #sound), #down)) then stopSound(getaProp(getaProp(obj, #sound), #down)) playSound(getaProp(getaProp(obj, #sound), #down), #keyframeCast, #NOW) end if set aCount to 1 set the castNum of sprite getaProp(obj, #spriteNum) to getAt(getaProp(getaProp(obj, #cast), #down), aCount) repeat while the stillDown set aCount to aCount + 1 if aCount > dncount then set aCount to 1 end if if inside(point(the mouseH, the mouseV), getAt(getaProp(obj, #HotRect), 1)) then set the castNum of sprite getaProp(obj, #spriteNum) to getAt(getaProp(getaProp(obj, #cast), #down), aCount) if not voidp(getaProp(getaProp(obj, #action), #WhileDown)) then do(getaProp(getaProp(obj, #action), #WhileDown)) end if else set the castNum of sprite getaProp(obj, #spriteNum) to theUP set aCount to 1 end if cursorandupdate() end repeat if not voidp(getaProp(getaProp(obj, #sound), #UP)) then stopSound(getaProp(getaProp(obj, #sound), #UP)) playSound(getaProp(getaProp(obj, #sound), #UP), #keyframeCast) end if set the castNum of sprite getaProp(obj, #spriteNum) to theUP cursorandupdate() if not voidp(getaProp(getaProp(obj, #action), #UP)) then do(getaProp(getaProp(obj, #action), #UP)) end if end on ButtonDNCOND ObjRef set obj to getaProp(gOBJECTS, ObjRef) if getaProp(getaProp(gOBJECTS, getaProp(obj, #Parent)), #State) = getaProp(obj, #ParentState) then if not voidp(getaProp(getaProp(obj, #sound), #down)) then stopSound(getaProp(getaProp(obj, #sound), #down)) playSound(getaProp(getaProp(obj, #sound), #down), #keyframeCast) end if set the castNum of sprite getaProp(obj, #spriteNum) to getaProp(getaProp(obj, #cast), #down) updateStage() repeat while the stillDown if inside(point(the mouseH, the mouseV), getAt(getaProp(obj, #HotRect), 1)) then set the castNum of sprite getaProp(obj, #spriteNum) to getaProp(getaProp(obj, #cast), #down) else set the castNum of sprite getaProp(obj, #spriteNum) to getaProp(getaProp(obj, #cast), #UP) end if cursorandupdate() end repeat set myPoint to point(the mouseH, the mouseV) if not voidp(getaProp(getaProp(obj, #sound), #UP)) then stopSound(getaProp(getaProp(obj, #sound), #UP)) playSound(getaProp(getaProp(obj, #sound), #UP), #keyframeCast) end if set the castNum of sprite getaProp(obj, #spriteNum) to getaProp(getaProp(obj, #cast), #UP) updateStage() if inside(myPoint, getAt(getaProp(obj, #HotRect), 1)) then do(getaProp(getaProp(obj, #action), #UP)) end if end if end on DragDN ObjRef set obj to getaProp(gOBJECTS, ObjRef) if not voidp(getaProp(getaProp(obj, #sound), #down)) then stopSound(getaProp(getaProp(obj, #sound), #down)) playSound(getaProp(getaProp(obj, #sound), #down), #keyframeCast) end if repeat while the stillDown set H to the mouseH set v to the mouseV set the locV of sprite getaProp(obj, #spriteNum) to v set the locH of sprite getaProp(obj, #spriteNum) to H cursorandupdate() end repeat if not voidp(getaProp(getaProp(obj, #sound), #UP)) then stopSound(getaProp(getaProp(obj, #sound), #UP)) playSound(getaProp(getaProp(obj, #sound), #UP), #keyframeCast) end if do(getaProp(getaProp(obj, #action), #UP)) set distance to getaProp(obj, #loc) - the loc of sprite getaProp(obj, #spriteNum) set HV to PointVals(distance) set H to getAt(HV, 1) set v to getAt(HV, 2) repeat while the loc of sprite getaProp(obj, #spriteNum) <> getaProp(obj, #loc) if v > 5 then set v to v - 5 set Vadd to 5 else if v < -5 then set v to v + 5 set Vadd to -5 else set Vadd to 0 end if end if if H > 5 then set H to H - 5 set Hadd to 5 else if H < -5 then set H to H + 5 set Hadd to -5 else set Hadd to 0 end if end if if (Hadd = 0) and (Vadd = 0) then set the loc of sprite getaProp(obj, #spriteNum) to getaProp(obj, #loc) end if set the locV of sprite getaProp(obj, #spriteNum) to the locV of sprite getaProp(obj, #spriteNum) + Vadd set the locH of sprite getaProp(obj, #spriteNum) to the locH of sprite getaProp(obj, #spriteNum) + Hadd cursorandupdate() end repeat end on CPPopUp ObjRef set obj to getaProp(gOBJECTS, ObjRef) do(getaProp(getaProp(obj, #action), #UP)) end on DoAction ObjRef set obj to getaProp(gOBJECTS, ObjRef) do(getaProp(getaProp(obj, #action), #UP)) end on OpenClose ObjRef set obj to getaProp(gOBJECTS, ObjRef) if getaProp(obj, #State) = #open then makeDynamic(ObjRef, #State, #close) else if getaProp(obj, #State) = #close then makeDynamic(ObjRef, #State, #open) end if end if if not voidp(getaProp(getaProp(obj, #sound), getaProp(obj, #State))) then playSound(getaProp(getaProp(obj, #sound), getaProp(obj, #State)), #keyframeCast) end if repeat with aCast in getaProp(getaProp(obj, #cast), getaProp(obj, #State)) set the castNum of sprite getaProp(obj, #spriteNum) to aCast cursorandupdate() end repeat do(getaProp(getaProp(obj, #action), #UP)) end on OpenCloseADDobj ObjRef set obj to getaProp(gOBJECTS, ObjRef) updateStage() if not voidp(getaProp(getaProp(obj, #SpecialChild), getaProp(obj, #State))) then Delobjects(getaProp(getaProp(obj, #SpecialChild), getaProp(obj, #State))) end if if getaProp(obj, #State) = #open then makeDynamic(ObjRef, #State, #close) else if getaProp(obj, #State) = #close then makeDynamic(ObjRef, #State, #open) end if end if if not voidp(getaProp(getaProp(obj, #sound), getaProp(obj, #State))) then playSound(getaProp(getaProp(obj, #sound), getaProp(obj, #State)), #keyframeCast) end if repeat with aCast in getaProp(getaProp(obj, #cast), getaProp(obj, #State)) set the castNum of sprite getaProp(obj, #spriteNum) to aCast updateStage() end repeat do(getaProp(getaProp(obj, #action), #UP)) if not voidp(getaProp(getaProp(obj, #SpecialChild), getaProp(obj, #State))) then ADDObjects(getaProp(getaProp(obj, #SpecialChild), getaProp(obj, #State))) end if end on getConstrainRect ObjRef set obj to getaProp(gOBJECTS, ObjRef) set halfWidth to the width of cast the castNum of sprite getaProp(obj, #spriteNum) / 2 set halfHeight to the height of cast the castNum of sprite getaProp(obj, #spriteNum) / 2 set constrainRect to rect(the left of sprite 1 + halfWidth, the top of sprite 1 + halfHeight, the right of sprite 1 - halfWidth, the bottom of sprite 1 - halfHeight) return constrainRect end on constrainSprite H, v, constrainRect if not inside(point(H, v), constrainRect) then if H < getAt(constrainRect, 1) then set H to getAt(constrainRect, 1) end if if H > getAt(constrainRect, 3) then set H to getAt(constrainRect, 3) end if if v < getAt(constrainRect, 2) then set v to getAt(constrainRect, 2) end if if v > getAt(constrainRect, 4) then set v to getAt(constrainRect, 4) end if end if return point(H, v) end on GrabDrag ObjRef set H to the mouseH set v to the mouseV set obj to getaProp(gOBJECTS, ObjRef) set OffsetH to H - the locH of sprite getaProp(obj, #spriteNum) set OffsetV to v - the locV of sprite getaProp(obj, #spriteNum) cursor(getaProp(gCursorList, #Grab)) if not voidp(getaProp(getaProp(obj, #sound), #down)) then stopSound(getaProp(getaProp(obj, #sound), #down)) playSound(getaProp(getaProp(obj, #sound), #down), #keyframeCast) end if set contrainRect to getConstrainRect(ObjRef) repeat while the stillDown set H to the mouseH set v to the mouseV set hLoc to H - OffsetH set vLoc to v - OffsetV constrainSprite(hLoc, vLoc, contrainRect) set the loc of sprite getaProp(obj, #spriteNum) to constrainSprite(hLoc, vLoc, contrainRect) cursorandupdate() end repeat if not voidp(getaProp(getaProp(obj, #sound), #UP)) then stopSound(getaProp(getaProp(obj, #sound), #UP)) playSound(getaProp(getaProp(obj, #sound), #UP), #keyframeCast) end if cursor(getaProp(gCursorList, #Hand)) updateStage() SetobjLOCRECT(ObjRef) if not voidp(getaProp(getaProp(obj, #action), #UP)) then do(getaProp(getaProp(obj, #action), #UP)) end if cursorandupdate() end on GrabDragCable ObjRef set H to the mouseH set v to the mouseV set obj to getaProp(gOBJECTS, ObjRef) set OffsetH to H - the locH of sprite getaProp(obj, #spriteNum) set OffsetV to v - the locV of sprite getaProp(obj, #spriteNum) set CABLEref to getaProp(obj, #Cable) set Anchor to getaProp(getaProp(gOBJECTS, CABLEref), #Anchor) if not voidp(getaProp(getaProp(obj, #sound), #down)) then stopSound(getaProp(getaProp(obj, #sound), #down)) playSound(getaProp(getaProp(obj, #sound), #down), #keyframeCast) end if cursor(getaProp(gCursorList, #Grab)) repeat while the stillDown set the locV of sprite getaProp(obj, #spriteNum) to v - OffsetV set the locH of sprite getaProp(obj, #spriteNum) to H - OffsetH set arect to rect(the locH of sprite getaProp(obj, #spriteNum), the locV of sprite getaProp(obj, #spriteNum), the locH of Anchor, the locV of Anchor) CableUpdate(CABLEref, arect) cursorandupdate() set H to the mouseH set v to the mouseV end repeat makeDynamic(CABLEref, #DisplayState, getaProp(getaProp(gOBJECTS, CABLEref), #DisplayState)) cursor(getaProp(gCursorList, #Hand)) if not voidp(getaProp(getaProp(obj, #sound), #UP)) then stopSound(getaProp(getaProp(obj, #sound), #UP)) playSound(getaProp(getaProp(obj, #sound), #UP), #keyframeCast, #NOW) end if if not voidp(getaProp(getaProp(obj, #action), #UP)) then do(getaProp(getaProp(obj, #action), #UP)) end if end on CableUpdate CABLEref, arect set Cable to getaProp(gOBJECTS, CABLEref) set t to the top of arect set B to the bottom of arect set l to the left of arect set R to the right of arect if R = l then set R to R + 3 end if if t = B then set B to B + 3 end if if t > B then if l > R then setaProp(Cable, #DisplayState, #left) else setaProp(Cable, #DisplayState, #right) end if else if l > R then setaProp(Cable, #DisplayState, #right) else setaProp(Cable, #DisplayState, #left) end if end if set the castNum of sprite getaProp(Cable, #spriteNum) to getaProp(getaProp(Cable, #cast), getaProp(Cable, #DisplayState)) set arect to rect(l, t, R, B) set the rect of sprite getaProp(Cable, #spriteNum) to arect end on SetobjLOCRECT ObjRef set obj to getaProp(gOBJECTS, ObjRef) set hotrectnum to integer(getaProp(obj, #spriteNum) & "01") makeDynamic(ObjRef, #loc, the loc of sprite getaProp(obj, #spriteNum)) set arect to list(the rect of sprite getaProp(obj, #spriteNum)) makeDynamic(ObjRef, #HotRect, arect) setaProp(getaProp(gHotRects, hotrectnum), #rect, getAt(getaProp(obj, #HotRect), 1)) end on DynamicLOCRECT ObjRef set obj to getaProp(gOBJECTS, ObjRef) if not voidp(getaProp(obj, #HotRect)) then if voidp(getaProp(obj, #Orginalrect)) then setaProp(obj, #OrginalHotrect, value(string(getaProp(obj, #HotRect)))) end if setAt(getaProp(obj, #HotRect), 1, the rect of sprite getaProp(obj, #spriteNum)) set hotrectnum to integer(getaProp(obj, #spriteNum) & "01") setaProp(getaProp(gHotRects, hotrectnum), #rect, getAt(getaProp(obj, #HotRect), 1)) else if not voidp(getaProp(obj, #SpriteProp)) then if not voidp(getaProp(getaProp(obj, #SpriteProp), #rect)) then if voidp(getaProp(obj, #Orginalrect)) then setaProp(obj, #Orginalrect, value(string(getaProp(getaProp(obj, #SpriteProp), #rect)))) end if setaProp(getaProp(obj, #SpriteProp), #rect, the rect of sprite getaProp(obj, #spriteNum)) end if end if end if if not voidp(getaProp(obj, #loc)) then if voidp(getaProp(obj, #OrginalLOC)) then setaProp(obj, #OrginalLOC, value(string(getaProp(obj, #loc)))) makeDynamic(ObjRef, #OrginalLOC, value(string(getaProp(obj, #loc)))) end if setaProp(obj, #loc, the loc of sprite getaProp(obj, #spriteNum)) end if end on ConstDrag ObjRef set obj to getaProp(gOBJECTS, ObjRef) set DirConst to getaProp(obj, #DirConst) set ConstMax to getaProp(obj, #ConstMax) set ConstMin to getaProp(obj, #ConstMin) if not voidp(getaProp(getaProp(obj, #sound), #down)) then stopSound(getaProp(getaProp(obj, #sound), #down)) playSound(getaProp(getaProp(obj, #sound), #down), #keyframeCast) end if cursor(getaProp(gCursorList, #Grab)) updateStage() if getaProp(obj, #DirConst) = #v then set OffsetV to the mouseV - the locV of sprite getaProp(obj, #spriteNum) repeat while the stillDown set v to the mouseV - OffsetV if (v < ConstMax) and (v > ConstMin) then if not voidp(getaProp(obj, #Children)) then set theChildren to getaProp(obj, #Children) repeat with Child in theChildren set distance to the locV of sprite getaProp(obj, #spriteNum) - v PullChild(Child, point(0, distance)) end repeat end if set the locV of sprite getaProp(obj, #spriteNum) to v if not voidp(getaProp(getaProp(obj, #action), #WhileDown)) then do(string(getaProp(getaProp(obj, #action), #WhileDown) & "(#" & ObjRef & ")")) end if cursorandupdate() end if end repeat else if getaProp(obj, #DirConst) = #H then set OffsetH to the mouseH - the locH of sprite getaProp(obj, #spriteNum) repeat while the stillDown set H to the mouseH - OffsetH if (H < ConstMax) and (H > ConstMin) then if not voidp(getaProp(obj, #Children)) then set theChildren to getaProp(obj, #Children) repeat with Child in theChildren set distance to the locH of sprite getaProp(obj, #spriteNum) - H PullChild(Child, point(distance, 0)) end repeat end if set the locH of sprite getaProp(obj, #spriteNum) to H if not voidp(getaProp(getaProp(obj, #action), #WhileDown)) then do(string(getaProp(getaProp(obj, #action), #WhileDown) & "(#" & ObjRef & ")")) end if cursorandupdate() end if end repeat end if end if if not voidp(getaProp(getaProp(obj, #sound), #UP)) then stopSound(getaProp(getaProp(obj, #sound), #UP)) playSound(getaProp(getaProp(obj, #sound), #UP), #keyframeCast) end if cursor(getaProp(gCursorList, #Hand)) updateStage() set hotrectnum to integer(getaProp(obj, #spriteNum) & "01") makeDynamic(ObjRef, #loc, the loc of sprite getaProp(obj, #spriteNum)) setAt(getaProp(obj, #HotRect), 1, the rect of sprite getaProp(obj, #spriteNum)) setaProp(getaProp(gHotRects, hotrectnum), #rect, getAt(getaProp(obj, #HotRect), 1)) repeat with Child in theChildren PullChildUPdate(Child) end repeat cursorandupdate() end on PullChild ObjRef, distance set obj to getaProp(gOBJECTS, ObjRef) set the loc of sprite getaProp(obj, #spriteNum) to the loc of sprite getaProp(obj, #spriteNum) - distance if not voidp(getaProp(obj, #Children)) then set theChildren to getaProp(obj, #Children) repeat with Child in theChildren PullChild(Child, distance) end repeat end if end on PullChildUPdate ObjRef set obj to getaProp(gOBJECTS, ObjRef) set hotrectnum to integer(getaProp(obj, #spriteNum) & "01") setaProp(obj, #loc, the loc of sprite getaProp(obj, #spriteNum)) setAt(getaProp(obj, #HotRect), 1, the rect of sprite getaProp(obj, #spriteNum)) setaProp(getaProp(gHotRects, hotrectnum), #rect, getAt(getaProp(obj, #HotRect), 1)) if not voidp(getaProp(obj, #Children)) then set theChildren to getaProp(obj, #Children) repeat with Child in theChildren PullChildUPdate(Child) end repeat end if end